//
//  PlayerManager.h
//  Leisure
//
//  Created by wenze on 16/4/6.
//  Copyright © 2016年 wenze. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

//播放模式
typedef NS_ENUM(NSUInteger, PlayType) {
    PlayTypeSingle, //单曲播放
    PlayTypeRandom, //随机
    PlayTypeList,  //顺序播放
};

//播放状态  (播放暂停)
typedef NS_ENUM(NSUInteger, PlayerState) {
    PlayerStatePlay,
    PlayerStatePause,
};

@interface PlayerManager : NSObject

//播放模式
@property (nonatomic, assign) PlayerState playState;
//播放状态
@property (nonatomic, assign) PlayType playType;

//记录播放的位置
@property (nonatomic, assign) NSInteger playIndex;
//播放列表
@property (nonatomic, strong) NSMutableArray *musicArray;

//当前播放时间
@property (nonatomic, assign, readonly) float currentTime;
//总时间
@property (nonatomic, assign, readonly) float totalTime;

//播放器
@property (nonatomic, strong) AVPlayer *avPlayer;



//单例
+ (instancetype) defaultManager;

//播放
- (void)play;
//暂停
- (void)pause;
//停止
- (void)stop;
//指定位置播放
- (void)seekToNewTime:(float)time;

//上一首
- (void)lastMusic;
//下一首
- (void)nextMusic;
//播放完成
- (void)playDidFinish;

- (void)changeMusicWithIndex:(NSInteger)index;


@end
